<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>订单详情</title>
	<!-- 公共样式 开始 -->
	<link rel="stylesheet" type="text/css" href="Resources/css/base.css">
	<link rel="stylesheet" type="text/css" href="Resources/css/iconfont.css">
	<script type="text/javascript" src="Resources/framework/jquery-1.11.3.min.js"></script>
	<link rel="stylesheet" type="text/css" href="Resources/layui/css/layui.css">
	<script type="text/javascript" src="Resources/layui/layui.js"></script>
	<!-- 滚动条插件 -->
	<link rel="stylesheet" type="text/css" href="Resources/css/jquery.mCustomScrollbar.css">
	<script src="Resources/framework/jquery-ui-1.10.4.min.js"></script>
	<script src="Resources/framework/jquery.mousewheel.min.js"></script>
	<script src="Resources/framework/jquery.mCustomScrollbar.min.js"></script>	
	<script type="text/javascript" src="Resources/js/check.js"></script>
	
</head>
<body>
	<div class="cBody">
		<div class="console">
			<form class="layui-form" action="listOrder?status=selectlike" method="post">
				<div class="layui-form-item">
					<div class="layui-input-inline">
						<input type="text" name="key" required lay-verify="required" placeholder="输入用户名" autocomplete="off" class="layui-input">
					</div>
					<button class="layui-btn" lay-submit lay-filter="formDemo">订单检索</button>
					<a class="layui-btn"  onclick="addOrder()">添加订单</a>
					<a class="layui-btn" onclick="deleteall('listOrder?status=delectquery&oids=');" href="#">批量删除</a>
				</div>
			</form>

		</div>
		
		<table class="layui-table">
			<thead>
				<tr>
					<th></th>
					<th>订单ID</th>
					<th>用户ID</th>
					<th>商品名</th>
					<th>数量</th>
					<th>订单状态</th>
					<th>小记</th>
					<th>操作</th>
				</tr>
			</thead>
			<tbody>
				<c:forEach items="${orderlist}" var="order" varStatus="st">
					<tr align="center">
						<td><input type="checkbox" name="child" value="${order.oid}" onclick="chickchild();"></td>
						<td><a href="listOrder?status=orderinfo&&oid=${order.oid}">${order.oid}</a></td>
						<td>${order.user.uname}</td>
						<td>${order.good.gName}</td>
						<td>${order.oNum}</td>
						<td>
						<c:if test="${order.status==0}">
							已完成
						</c:if>
						<c:if test="${order.status==1}">
							未完成
						</c:if>
						</td>
						<td>￥：${order.oNum*order.good.gPrice } </td>
						<td>
							<button class="layui-btn layui-btn-xs" onclick="updateBut('${order.oid}')">修改</button>
							<button class="layui-btn layui-btn-xs" onclick="location.href='listOrder?status=delect&&oid=${order.oid}'">删除</button>
						</td>
					</tr>
				</c:forEach>
			</tbody>
			<thead>
				<tr>
				<td colspan="12">
					<input type="checkbox" id="checkAll" name="checkAll" onclick="selectAll();">全选&emsp;&emsp;
					<input type="checkbox" id="recheck" onclick="notSelectAll()">反选
					<div align="center">
						<a href="listOrder?status=selectall&start=0">首页</a>&emsp;
						<a href="listOrder?status=selectall&start=${prePage}">前一页</a>&emsp;
						<a href="listOrder?status=selectall&start=${nextPage}">后一页</a>&emsp;
						<a href="listOrder?status=selectall&start=${totalPage-1}">尾页</a>&emsp;
					</div>
				</td>
			</tr>
			<tr><td colspan="12" align="center">当前页: ${star}&emsp;总页数：${totalPage}&emsp;总记录：${totalsize}</td></tr>
			</thead>
		</table>
		
		<!-- layUI 分页模块 -->
		<div id="pages"></div>
		<script>
		//添加新订单
		function addOrder(){
			layui.use('layer', function() {
				var layer = layui.layer;
				//iframe层-父子操作
				layer.open({
					title:"添加新订单",
					type: 2,
					area: ['70%', '60%'],
					fixed: false, //不固定
					maxmin: true,
					content: 'listOrder?status=addjsp'
				});
			});
		}
			

			//修改按钮
			var updateFrame = null;
			function updateBut(oid){
				layui.use('layer', function() {
					var layer = layui.layer;
						
					//iframe层-父子操作
					updateFrame = layer.open({
                   		title: "订单修改",
						type: 2,
						area: ['70%', '60%'],
						scrollbar: false,	//默认：true,默认允许浏览器滚动，如果设定scrollbar: false，则屏蔽
						maxmin: true,
						content: 'listOrder?status=orderinfo&oid='+oid
					});
				});
				
			}
		</script>
	</div>
</body>
</html>